<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <script src = 'jquery-1.12.4.min.js'></script>
    <title>fadeOut</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .bord{
            border: 1px dashed #ee2602;
            width: 90%;
            margin: 20px auto;
        }
        .title{
            font-size: 20px;
            font-weight: bold;
            margin: 20px;
        }
        .introduce{
            font-size: 16px;
            margin: 0 0 20px 50px;
        }
        .red{
            color: red;
        }
    </style>
    <script>
        jQuery(function ($) {
            $('#mybtn').click(function () {
                $("#a").fadeOut(2000);
            })
        });
    </script>
</head>
<body>
<div class="bord">
    <div class="title">fadeOut</div>
    <div class="introduce">
        通过不透明度的变化来实现所有匹配元素的淡入效果，并在动画完成后可选地触发一个回调函数。</div>
</div>
<div class="bord">
    <div class="title">演示效果</div>
    <div class="introduce">
        <div style="width: 100px;height: 100px;background-color: #dc2d45;" id="a" ></div>
        <br/>
        <button id="mybtn">隐藏div</button>
    </div>
</div>
<div class="bord">
    <div class="title">代码</div>
    <div class="introduce">
        <pre>
&lt;script&gt;
    jQuery(function ($) {
       $('#mybtn').click(function () {
                $("#a").<a class="red">fadeOut(2000)</a>;
            })
    });
&lt;/script&gt;
             <br/>
&lt;div class="introduce"&gt;
    &lt;div style="width: 100px;height: 100px;background-color: #dc2d45;" id="a"&gt;&lt;/div&gt;
    &lt;button id="mybtn"&gt;隐藏div&lt;/button&gt;
&lt;/div&gt;
        </pre>
    </div>
</div>
</body>
</html>